package com.qdu.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qdu.bean.Pic;
import com.qdu.mapper.PicMapper;
import com.qdu.service.PicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PicServiceIml implements PicService {
    @Autowired
    PicMapper picMapper;
    @Override
    public Pic addPic(Pic pic) {
        picMapper.addPic(pic);
        return picMapper.getId();
    }

    @Override
    public void updatePic(Pic pic) {
        picMapper.updatePic(pic);
    }

    @Override
    public PageInfo<Pic> queryPic(String company, Integer power, Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        List<Pic> picList = picMapper.queryPic(company, power);
        PageInfo<Pic> picPageInfo = new PageInfo<>(picList);
        return picPageInfo;
    }

    @Override
    public void deletePic(String id) {
        picMapper.deletePic(id);
    }

    @Override
    public void handlePass(String id) {
        picMapper.deletePic(id);
    }
}
